package com.sharer.last.utils.comment.channel;


import com.sharer.last.constant.CommentConstants;
import com.sharer.last.utils.common.SpringContextUtils;

/**
 * 评论提醒方式
 *
 * @ClassName ChannelFactory
 * @Author wangjin
 * @Date 2023/5/5 20:47
 * @Description
 * @Version 1.0
 */
public class ChannelFactory {
	/**
	 * 创建评论提醒方式
	 *
	 * @param channelName 方式名称
	 * @return
	 */
	public static CommentNotifyChannel getChannel(String channelName) {
		 if (CommentConstants.MAIL.equalsIgnoreCase(channelName)) {
			return SpringContextUtils.getBean("mailChannel", CommentNotifyChannel.class);
		}
		throw new RuntimeException("Unsupported value in [application.properties]: [comment.notify.channel]");
	}
}
